package config

import (
    "flag"
    "time"
)

var (
    localTest         = flag.Bool("local-test", false, "(optional) in cluster config")
    debugMode         = flag.Bool("debug-mode", false, "(optional) debug mode")
    aPIServerPort     = flag.Int("api-server-port", 41000, "(optional) API server port")
    singerPort        = flag.Int("singer-port", 41001, "(optional) Singer port")
    plannerPort       = flag.Int("planner-port", 41002, "(optional) Planner port")
    conductTimeout    = flag.Int("singing-conduct-timeout", 10, "(optional) singing conduct timeout in seconds")
    conductDuration   = flag.Int("conduct-duration", 10, "(optional) singing conduct duration in seconds")
    conductDelay      = flag.Int("conduct-delay", 100, "(optional) singing conduct delay in milliseconds, do conduct in advance of these times")
    singerGrpcTimeout = flag.Int("singer-grpc-timeout", 10, "(optional) singer grpc TransientFailure timeout in seconds")
    clusterDomainName = flag.String("cluster-domain-name", "cluster.local", "(optional) the domain name for your cluster")
)

var (
    LocalTest         bool
    DebugMode         bool
    APIServerPort     int
    SingerPort        int
    PlannerPort       int
    ConductTimeout    time.Duration
    ConductDuration   time.Duration
    ConductDelay      time.Duration
    SingerGrpcTimeout time.Duration
    ClusterDomainName string
)

func initFlags() {
    flag.Parse()
    LocalTest = *localTest
    DebugMode = *debugMode
    APIServerPort = *aPIServerPort
    SingerPort = *singerPort
    PlannerPort = *plannerPort
    ConductTimeout = time.Duration(*conductTimeout) * time.Second
    ConductDuration = time.Duration(*conductDuration) * time.Second
    ConductDelay = time.Duration(*conductDelay) * time.Millisecond
    SingerGrpcTimeout = time.Duration(*singerGrpcTimeout) * time.Second
    ClusterDomainName = *clusterDomainName
}
